<template>
  <div class="newsinfo">
    <header>
      <h1 class="title">{{newsinfo.title}}</h1>
      <div class="btn-group">
        <span class="add_time">{{newsinfo.add_time}}</span>
        <span>点击{{newsinfo.click}}次</span>

      </div>
      <hr/>
    </header>
    <div class="content">
      {{newsinfo.content}}
    </div>
    <comment :id="id"></comment>
  </div>

</template>

<script >
import Comment from '../../../../components/Comment'
export default {
  data: () => ({
    id: 0,
    newsinfo: {}
  }),
  components: {
    Comment
  },

  created () {
    this.id = this.$route.params.id
    this.getnew()
  },

  methods: {
    async getnew () {
      const {
        data: { status, message }
      } = await this.$axios.get('api/getnew/' + this.id)
      if (status !== 0) this.$Toast(message)
      this.newsinfo = message
    }
  }
}

</script>
<style lang="less" scoped>
header{
  padding: 8px;
.title{
  font-size: 16px;
  color:red;
}
.btn-group{
  display:flex;
  justify-content: space-between;
  span{
    font-size: 12px;
  }
  .add_time{
    color:blue;
  }
}
}
.content{
  line-height: 24px;
  font-size: 14px;
  text-align: justify;
  padding:0px 2px;
}

</style>
